package com.framework.loippi.service.impl;

import com.framework.loippi.dao.AdDao;
import com.framework.loippi.entity.Ad;
import com.framework.loippi.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * SERVICE - Ad
 * 
 * @author Loippi Team
 * @version 1.0
 */
@Service
public class AdServiceImpl extends GenericServiceImpl<Ad, Long>implements AdService {

	@Autowired
	private AdDao adDao;

	@Override
	public List<Ad> findList(Map<String, Object> params,Boolean loadCategory) {
		List<Ad> list = super.findList(params);
		if (Boolean.TRUE.equals(loadCategory)) {
			for(Ad ad:list){
				if(ad.getCategoryId() != null){
				}
			}
		}
		return list;
	}

	@Autowired
	public void setGenericDao() {
		super.setGenericDao(adDao);
	}

	@Override
	public void updateStatusStart() {
		adDao.updateStatusStart();
	}

	@Override
	public void updateTimeOut() {
		adDao.updateTimeOut();
	}
}
